package tr.edu.metu.is.mega.client.service;

import tr.edu.metu.is.mega.common.UserNotFoundException;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * GWT mail service.
 */
@RemoteServiceRelativePath("../GwtMailService")
public interface GwtMailService extends RemoteService {

    /**
     * Utility class for simplifying access to the instance of async service.
     */
    public static class Util {

        private static GwtMailServiceAsync instance;

        /**
         * Initiates and returns singleton instance of service.
         * 
         * @return singleton instance of service
         */
        public static GwtMailServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(GwtMailService.class);
            }
            return instance;
        }
    }

    /**
     * Sends login information of user with given e-mail.
     * 
     * @param email email of user
     * @throws UserNotFoundException user not found in DB
     */
    void sendLoginInfo(String email) throws UserNotFoundException;

}
